package com.feiwo.nonego.rpc.provider.server;

import com.feiwo.nonego.rpc.provider.common.scanner.RpcServiceScanner;
import com.feiwo.nonego.rpc.provider.common.server.base.BaseServer;
import com.feiwo.nonego.rpc.registry.api.enums.RegistryType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;

/**
 * @author feiwo 2025-08-04
 */
public class RpcSingleServer extends BaseServer {

    private static final Logger LOGGER = LoggerFactory.getLogger(RpcSingleServer.class);

    public RpcSingleServer(String severAddress, String registryAddress, String scanPackage, String reflectType, RegistryType registryType, String loadBalancerType) {
        super(severAddress, registryAddress, reflectType, registryType, loadBalancerType);
        try {
            this.handlerMap = RpcServiceScanner.doScannerRpcServiceIntoRegistry(this.host, this.port,scanPackage, this.registryService);
        } catch (IOException e) {
            LOGGER.error("RPC Server init ex ---> ", e);
        }
    }
}
